if (stbuf.st_mtime > curtime_secs)
continue;
- /* Now, we arbitrarily delete files/directories older than a
- * day, since that's what we were doing before we had locking.
+ /* Now, we're pruning content based on the expiry, which
+ * defaults to a day. That's what we were doing before we
+ * had locking...but in future we can be smarter here.
*/
delta = curtime_secs - stbuf.st_mtime;
- if (delta > 60*60*24)
+ if (delta > self->tmp_expiry_seconds)
{
if (!glnx_shutil_rm_rf_at (dfd_iter.fd, dent->d_name, cancellable, error))
goto out;
ostree_repo_set_disable_fsync (self, TRUE);
}
+ { g_autofree char *tmp_expiry_seconds = NULL;
+
+ /* 86400 secs = one day */
+ if (!ot_keyfile_get_value_with_default (self->config, "core", "tmp-expiry-secs", "86400",
+ &tmp_expiry_seconds, error))
+ goto out;
+
+ self->tmp_expiry_seconds = g_ascii_strtoull (tmp_expiry_seconds, NULL, 10);
+ }
+
if (!append_remotes_d (self, cancellable, error))
goto out;